Skip to content

editorconfig: don't trim trailing whitespace in tests #144642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025

Conversation

lolbinarycat
Copy link
Contributor

some test snapshot files require trailing whitespace, and previously manually editing those snapshot files (as is required for run-make tests and some platform-specific tests) in an editor with editorconfig support would cause that whitespace to be removed, causing CI failures like this one

@rustbot
Copy link
Collaborator

rustbot commented Jul 29, 2025

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 29, 2025

Some changes occurred in src/tools/cargo

cc @ehuss

@rustbot

This comment has been minimized.

@lolbinarycat lolbinarycat force-pushed the editorconfig-no-run-make branch from 9f764bd to 504a2c1 Compare July 29, 2025 17:01
@mati865
Copy link
Member

mati865 commented Jul 31, 2025

How about disabling it only for stdout and stderr files in tests?

@lolbinarycat
Copy link
Contributor Author

@mati865 there's a few run-make tests that use other file extensions, so collecting a comprehensive list might be a bit tricky.

i think more reliable maybe would be disabling it for all tests/ files except those written in rust and js?

@mati865
Copy link
Member

mati865 commented Jul 31, 2025

@lolbinarycat that sounds sensible to me but I'd leave the decision to the reviewer.

@ehuss
Copy link
Contributor

ehuss commented Aug 6, 2025

r? compiler

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 6, 2025
@rustbot rustbot assigned lcnr and unassigned ehuss Aug 6, 2025
@lcnr
Copy link
Contributor

lcnr commented Aug 7, 2025

I would personally also prefer to limit this restriction only to affected tests. I think it's fine for this to be an ad-hoc list of tests where it matters. I would personally love there to be a tidy check which makes sure we keep some //@ editor-no-trim-whitespace attribute in sync with an opt out in the editor config (and some way to bless the editor config file)

But 🤷 I think only listing the effected test in the editor config would also be fine, don't have any strong opinions here

@lolbinarycat
Copy link
Contributor Author

I would personally also prefer to limit this restriction only to affected tests.

There are over 850 affected tests.

@lcnr
Copy link
Contributor

lcnr commented Aug 8, 2025

and these tests rely on their trailing whitespace? as in, how many tests actually intend to have trailing whitespace instead of being cases where we maybe should actually change them to not do so.

I don't want to block a change which prevents some editors from silently messing up your PR for the sake of a larger change, so I'd be fine with merging this for now and opening an issue that we should reenable this for at least ui tests and maybe even have a tidy check for it

@lolbinarycat lolbinarycat force-pushed the editorconfig-no-run-make branch from 504a2c1 to cad16c3 Compare August 8, 2025 16:07
@lolbinarycat lolbinarycat force-pushed the editorconfig-no-run-make branch from cad16c3 to 7af87d1 Compare August 8, 2025 16:15
@lolbinarycat
Copy link
Contributor Author

and these tests rely on their trailing whitespace? as in, how many tests actually intend to have trailing whitespace instead of being cases where we maybe should actually change them to not do so.

There's also 4381 tests that end with multiple newlines, something that has an actual affect on UX, and something that is also (at least in emacs) also controlled by the trim_trailing_whitespace option.

I re-enabled trim_trailing_whitespace for source files in tests/, except for the two tests that intentionally have trailing whitespace. Hopefully this should be good enough to merge now.

@lcnr
Copy link
Contributor

lcnr commented Aug 12, 2025

sgtm

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 12, 2025

📌 Commit 7af87d1 has been approved by lcnr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 12, 2025
Kobzol added a commit to Kobzol/rust that referenced this pull request Aug 12, 2025
…ake, r=lcnr

editorconfig: don't trim trailing whitespace in tests

some test snapshot files require trailing whitespace, and previously manually editing those snapshot files (as is required for run-make tests and some platform-specific tests) in an editor with editorconfig support would cause that whitespace to be removed, [causing CI failures like this one](rust-lang#144596 (comment))
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 12, 2025
…ake, r=lcnr

editorconfig: don't trim trailing whitespace in tests

some test snapshot files require trailing whitespace, and previously manually editing those snapshot files (as is required for run-make tests and some platform-specific tests) in an editor with editorconfig support would cause that whitespace to be removed, [causing CI failures like this one](rust-lang#144596 (comment))
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 12, 2025
…ake, r=lcnr

editorconfig: don't trim trailing whitespace in tests

some test snapshot files require trailing whitespace, and previously manually editing those snapshot files (as is required for run-make tests and some platform-specific tests) in an editor with editorconfig support would cause that whitespace to be removed, [causing CI failures like this one](rust-lang#144596 (comment))
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 12, 2025
…ake, r=lcnr

editorconfig: don't trim trailing whitespace in tests

some test snapshot files require trailing whitespace, and previously manually editing those snapshot files (as is required for run-make tests and some platform-specific tests) in an editor with editorconfig support would cause that whitespace to be removed, [causing CI failures like this one](rust-lang#144596 (comment))
bors added a commit that referenced this pull request Aug 12, 2025
Rollup of 7 pull requests

Successful merges:

 - #144642 (editorconfig: don't trim trailing whitespace in tests)
 - #144955 (search graph: lazily update parent goals)
 - #145153 (Handle macros with multiple kinds, and improve errors)
 - #145250 (Add regression test for former ICE involving malformed meta items containing interpolated tokens)
 - #145269 (Deprecate RUST_TEST_* env variables)
 - #145289 (chore(ci): upgrade checkout to v5)
 - #145303 (Docs: Link to payload_as_str() from payload().)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 13, 2025
Rollup of 7 pull requests

Successful merges:

 - #144642 (editorconfig: don't trim trailing whitespace in tests)
 - #144955 (search graph: lazily update parent goals)
 - #145153 (Handle macros with multiple kinds, and improve errors)
 - #145250 (Add regression test for former ICE involving malformed meta items containing interpolated tokens)
 - #145269 (Deprecate RUST_TEST_* env variables)
 - #145289 (chore(ci): upgrade checkout to v5)
 - #145303 (Docs: Link to payload_as_str() from payload().)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Aug 13, 2025
Rollup of 11 pull requests

Successful merges:

 - #143467 (Add ASCII-related methods from `u8` and `MIN`/`MAX` to `core::ascii::Char`)
 - #144519 (Constify `SystemTime` methods)
 - #144642 (editorconfig: don't trim trailing whitespace in tests)
 - #144870 (Stabilize `path_file_prefix` feature)
 - #145269 (Deprecate RUST_TEST_* env variables)
 - #145274 (Remove unused `#[must_use]`)
 - #145289 (chore(ci): upgrade checkout to v5)
 - #145303 (Docs: Link to payload_as_str() from payload().)
 - #145308 (Adjust documentation of `dangling`)
 - #145320 (Allow cross-compiling the Cranelift dist component)
 - #145325 (Add `cast_init` and `cast_uninit` methods for pointers)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 900e568 into rust-lang:master Aug 13, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 13, 2025
rust-timer added a commit that referenced this pull request Aug 13, 2025
Rollup merge of #144642 - lolbinarycat:editorconfig-no-run-make, r=lcnr

editorconfig: don't trim trailing whitespace in tests

some test snapshot files require trailing whitespace, and previously manually editing those snapshot files (as is required for run-make tests and some platform-specific tests) in an editor with editorconfig support would cause that whitespace to be removed, [causing CI failures like this one](#144596 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants